
#@layer()

#define css()
<style type="text/css">
    body {
        background-image: url(http://47.105.208.60:8080/wechat-api/images/loginbg.png);
        background-position: center center;
        background-repeat: no-repeat;
        background-attachment: fixed;
        background-size: cover;
    }

    table#table {
        margin-left: auto;
        margin-right: auto;
        background: #F7F7F7;
        opacity: 0.95;
        padding: 25px 15px 25px 10px;
        font: 12px Georgia, "Times New Roman", Times, serif;
        color: #888;
        text-shadow: 1px 1px 1px #FFF;
        border: 1px solid #E4E4E4;
        text-align: center;
    }

    body h1 {
        font-size: 50px;
        padding: 0px 0px 10px 40px;
        display: block;
        color: slategrey;
        text-align: center;
    }

    form#form .button {
        background: #E27575;
        border: none;
        padding: 10px 25px 10px 25px;
        margin: 10px 20px 10px 100px;
        color: #FFF;
        box-shadow: 1px 1px 5px #B6B6B6;
        border-radius: 3px;
        text-shadow: 1px 1px 1px #9E3F3F;
        cursor: pointer;
    }
</style>
#end

#define script()

<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>

    function onLoadByPage() {
        var url="http://47.105.208.60:8080/wechat-api/api/like?realname=#(realname ??)";
        //var url = "http://localhost:8080/wechat-api/api/like?realname=#(realname ??)";
        $.ajax({
            url: url
            , dataType: 'json'
            , type: 'get'
            , success: function (data) {
                console.log("+++++++")
                console.log(data)
                var contentArr = '';
                if (data.code == 0) {
                    var infos = data.info;
                    $(infos).each(function () {
                        var content = "<tr id='tr-" + infos + "' class='tr'>";
                        content += "<td> <input type='radio' name='xuanze' class='xuanze' ></td>";
                        content += "<td class='realname'>" + this.nickname + "</td>";
                        content += "<td class='id'>" + this.id + "</td>";
                        content += "</tr>";
                        $("#tbody").append($(content));

                    })
                } else {
                    console.log("========")
                    alert("操作失败");//请求传输失败回调函数
                }
            }
            , error: function (msg) {
                console.log("----------")
                alert("ajax错误"); //错误信息

            }
        });
    }

    function setValue() {
        var val1 = $('input:radio:checked').parent().parent("tr").find("td").eq(1).text();
        var val2 = $('input:radio:checked').parent().parent("tr").find("td").eq(2).text();
        window.opener.document.getElementById("nickname").value = val1;
        window.opener.document.getElementById("id").value = val2;
        window.close();
    }

    onLoadByPage();
</script>
#end

#define content()

<!--<body>-->
<!--<div class="content-wrapper">-->
<div>

    <table border="1" id="table" style="height: 90%; width: 90%">
        <thead>
        <tr>
            <th></th>
            <th>作者姓名</th>
        </tr>
        <thead>

        <tbody id="tbody" class="tbody">

        </tbody>
    </table>

</div>

<div>
    <form id="form" action="" method="post">
        <input type="button" class="button" value="确定" onclick="setValue()">
    </form>

</div>
<!--</div>-->
#end

